import {createStore} from 'vuex'

export default createStore({
    state: {
        member: window.SessionStorage.get(SESSION_MEMBER) || {},
        captchaToken: undefined
    },
    getters: {
    },
    mutations: {
        // 保存用户信息
        setMember(state, _member) {
            state.member = _member
            window.SessionStorage.set(SESSION_MEMBER, _member)
        },
        // 异常用户信息
        removeMember(state) {
            state.member = {}
            window.SessionStorage.remove(SESSION_MEMBER)
        },
        // 刷新验证码token
        refreshCaptchaToken(state, _token) {
            state.captchaToken = _token
        }
    },
    actions: {
    },
    modules: {
    }
})
